package com.ptsz.mydatbase;

import androidx.annotation.RequiresApi;
import androidx.appcompat.app.AppCompatActivity;

import android.content.ContentValues;
import android.database.sqlite.SQLiteDatabase;
import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.util.Log;
import android.view.View;

import com.dpp.dbase.api.PdParent;
import com.dpp.dbase.db.PdOptDb;
import com.dpp.dbase.gpkg.PdOptGpkg;
import com.dpp.dbase.result.PdResult;
import com.esri.arcgisruntime.data.Feature;
import com.esri.arcgisruntime.data.GeoPackage;
import com.esri.arcgisruntime.data.GeoPackageFeatureTable;
import com.esri.arcgisruntime.data.QueryParameters;
import com.esri.arcgisruntime.geometry.Geometry;
import com.esri.arcgisruntime.layers.FeatureLayer;
import com.esri.arcgisruntime.loadable.LoadStatus;
import com.esri.arcgisruntime.mapping.ArcGISMap;
import com.esri.arcgisruntime.mapping.Basemap;
import com.esri.arcgisruntime.mapping.view.MapView;
import com.esri.arcgisruntime.symbology.SimpleFillSymbol;
import com.esri.arcgisruntime.symbology.SimpleLineSymbol;
import com.esri.arcgisruntime.symbology.SimpleMarkerSymbol;
import com.esri.arcgisruntime.symbology.UniqueValueRenderer;
import com.ptsz.mydatbase.tianditu.TianDiTuLayer;
import com.ptsz.mydatbase.tianditu.TianDiTuLayerBuilder;
import com.ptsz.mydatbase.tianditu.TianDiTuLayerTypes;
import com.ptsz.mydatbase.utils.Config;
import com.ptsz.mydatbase.utils.Constants;
import com.ptsz.mydatbase.utils.DbManage;
import com.ptsz.mydatbase.utils.TemplateInfo;

import java.io.File;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class MainActivity extends AppCompatActivity {


    public static FeatureLayer mFeatureLayer, mPointShpLayer, mPolylineShpLayer, mPolygonShpLayer, mBackFeatureLayer, mBackPointShpLayer, mBackPolylineShpLayer, mBackPolygonShpLayer;
    private static SQLiteDatabase db;
    private static DbManage dbHelper;

    private int sum = 100000;
    String geom = "{\"rings\":[[[105.20397615900001,27.097685058],[105.203978248,27.097680049000001],[105.203977099,27.097668212999999],[105.203971444,27.097639208],[105.203983396,27.097632706999999],[105.204010295,27.097626743999999],[105.204044947,27.097609382000002],[105.204067606,27.097598605000002],[105.204080948,27.097600375999999],[105.204100303,27.097605721000001],[105.204147707,27.097631918000001],[105.204169732,27.097639647000001],[105.20419908700001,27.097643782999999],[105.204220484,27.097651807999998],[105.20422444899999,27.097653296000001],[105.20425850300001,27.097672947],[105.204278927,27.097680728],[105.20428786700001,27.097681858000001],[105.20434388699999,27.097677598000001],[105.204367504,27.097678913999999],[105.204339375,27.097637470999999],[105.204337748,27.097623147],[105.20433772,27.097608103999999],[105.204339301,27.097596639999999],[105.20430227200001,27.097593347],[105.20430811,27.097576622999998],[105.20431981599999,27.097558458000002],[105.20432565199999,27.097538870000001],[105.204332557,27.097522145999999],[105.20434854299999,27.097509706],[105.204376805,27.097499159000002],[105.20441467800001,27.097492418000002],[105.20444082100001,27.097490469],[105.204472309,27.097494243],[105.20450326,27.097495153000001],[105.204520343,27.097498948999998],[105.204540102,27.097508473000001],[105.204545208,27.097517215],[105.204535863,27.097524237999998],[105.204523067,27.097529509000001],[105.204515605,27.097534295999999],[105.20452309300001,27.097544314],[105.204539658,27.097557183999999],[105.20455301,27.097564328000001],[105.20456528299999,27.097563832999999],[105.204578639,27.097572410000001],[105.204598397,27.097580976],[105.204622954,27.097587148999999],[105.20464110100001,27.097589510999999],[105.204658176,27.097589487],[105.20466992199999,27.097594245],[105.204688076,27.097599948999999],[105.204707813,27.097596099],[105.204722241,27.097587819000001],[105.20473711699999,27.097572179],[105.20475576699999,27.097558303],[105.20477656,27.097548243999999],[105.204787743,27.097536287],[105.204801598,27.097525284],[105.204807977,27.097511902000001],[105.204815419,27.09749661],[105.20482713,27.097480831999999],[105.204834572,27.097465540000002],[105.204846816,27.097450240000001],[105.20485959200001,27.097433506000002],[105.204871306,27.097419640999998],[105.2048873,27.097411499],[105.204901167,27.097407657000002],[105.20492038499999,27.097412882],[105.204940139,27.097419063],[105.204966309,27.097431918000002],[105.204980742,27.097445269000001],[105.204991974,27.097460535],[105.205,27.097471984999999],[105.205005883,27.097480095000002],[105.205022442,27.097490099000002],[105.20503687199999,27.097502018],[105.20505449700001,27.097511065999999],[105.20507159500001,27.097523458000001],[105.205090838,27.097542055000002],[105.205103131,27.097553499],[105.205123634,27.097564694999999],[105.205144463,27.097576126],[105.20519655,27.097608285],[105.20522902,27.097657172000002],[105.205335709,27.097654468999998],[105.205333348,27.097643305999998],[105.20534053599999,27.0976347],[105.205352527,27.097626802000001],[105.205356497,27.097608887],[105.205359672,27.097594556000001],[105.205370847,27.097578064],[105.205396452,27.097573728],[105.20541566,27.097572982999999],[105.20542205700001,27.097569392],[105.205423641,27.097560079000001],[105.205421222,27.097549336],[105.20536355199999,27.097527929999998],[105.205245826,27.097490136000001],[105.20519057,27.097475171999999],[105.20513369699999,27.097450900999998],[105.20508321600001,27.097419455000001],[105.20494775500001,27.097312917],[105.20490129700001,27.097294359999999],[105.204602773,27.097307690000001],[105.204530742,27.097309941999999],[105.20448991400001,27.097305704],[105.20430491099999,27.097244366999998],[105.204230462,27.097238028],[105.204153643,27.097248884999999],[105.20403842499999,27.097269825000001],[105.20390487100001,27.097331624999999],[105.203844835,27.097357852999998],[105.203855335,27.097382234000001],[105.20385804599999,27.097406110000001],[105.203854085,27.097429992999999],[105.203866135,27.097453854000001],[105.203854183,27.097483716999999],[105.203832887,27.097510016000001],[105.20380623200001,27.097523188],[105.20376222100001,27.097530414000001],[105.20371953900001,27.097532864000001],[105.203698209,27.097541251999999],[105.203684899,27.097556791999999],[105.20368093800001,27.097580677],[105.203666325,27.097614128],[105.203643709,27.097647589000001],[105.203636976,27.097689073000002],[105.203652229,27.097689346999999],[105.20368625899999,27.097695863999999],[105.20371148,27.097696592999998],[105.203725612,27.097697003],[105.203760296,27.097696952],[105.203769631,27.09769455],[105.203834292,27.09767416],[105.20388831,27.097668113000001],[105.203898729,27.097662964000001],[105.203920682,27.097711483000001],[105.203943358,27.097710257999999],[105.203965353,27.097701271999998],[105.20397615900001,27.097685058]]],\"spatialReference\":{\"wkid\":4490}}";

    ArcGISMap mArcGISMap = new ArcGISMap();
    MapView mapview;
    protected TianDiTuLayer tdtgz, tdtgz2;

    public void TDTImage() {
        Basemap basemap = new Basemap();
        mArcGISMap.getBasemap().getBaseLayers().clear();
        tdtgz = new TianDiTuLayerBuilder().setContext(this)
                .setLayerType(TianDiTuLayerTypes.TIANDITU_IMAGE_2000)
                .setCachePath(Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator + "collect" + File.separator + "mappable" + File.separator)
                .setType("tianditu")
                .build();
        tdtgz2 = new TianDiTuLayerBuilder().setContext(this)
                .setLayerType(TianDiTuLayerTypes.TIANDITU_IMAGE_ANNOTATION_CHINESE_2000)
                .setCachePath(Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator + "collect" + File.separator + "mappable" + File.separator)
                .setType("tianditu")
                .build();
        basemap.getBaseLayers().add(tdtgz);
        basemap.getBaseLayers().add(tdtgz2);
        mArcGISMap.setBasemap(basemap);
    }

    @RequiresApi(api = Build.VERSION_CODES.O)
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        dbHelper = new DbManage(this);
        dbHelper.openDatabase();
        db = dbHelper.getDatabase();

        mapview = findViewById(R.id.mapview);
        //初始话请求
        mapview.setMap(mArcGISMap);
        //去除logo
        mapview.setAttributionTextVisible(false);

        loadGpkg();
        TDTImage();
        findViewById(R.id.modify).setOnClickListener(v -> {

            PdResult<Integer> templateinfo1 = PdOptDb.getInstance().searchDbCount(db, "templateinfo");
            System.out.println("sdjkfl");
            PdResult<Integer> integerPdResult = PdOptDb.getInstance().searchDbMax(db, "templateinfo", "id");
            System.out.println("sdjlfsd");

//                modifyGpkg();

//            Map<String, Object> attributes = new HashMap<>();
//            attributes.put("collectTime", "dengpp");
//            attributes.put("specklesCode", "sdfdf");
//            attributes.put("specklesName", "coll.getSpecklesName()");
//            attributes.put("geom", geom);
//            attributes.put("specklesAttribute", "coll.getSpecklesAttribute()");
//            attributes.put("shapeType", "coll.getShapeType()");
//            attributes.put("templateCode", "coll.getTemplateCode()");
//            attributes.put("collectCode", "coll.getCollectCode()");
//            attributes.put("userId", "Constants.userId");
//            attributes.put("collectTime", "coll.getCollectTime()");
//            attributes.put("uploadTime", "coll.getUploadTime()");
//            attributes.put("address", " coll.getAddress()");
//            attributes.put("pac", "5202103");
//            attributes.put("state", "1");
//            attributes.put("isupload", "1");//0、基础数据，1、已采集
//            attributes.put("phase", "1");
//            Feature feature = mPolygonShpLayer.getFeatureTable().createFeature(attributes, Geometry.fromJson(geom));
//            PdResult pdResult = PdOptGpkg.getInstance().addGpkg(mPolygonShpLayer, feature);
//            if (pdResult.getStatus()) {
//                Log.e("Gpkg修改成功", " data2.getName()");
//            }

//
            ContentValues values = new ContentValues();
            values.put("name", "dengpp");
            PdResult pdResult1 = PdOptDb.getInstance().addDb(db, "templateinfo", values);
            PdResult<List<TemplateInfo>> listPdResult = PdOptDb.getInstance().searchDb(db, TemplateInfo.class);
            Boolean status = listPdResult.getStatus();
            if (status) {
                List<TemplateInfo> data = listPdResult.getData();
                PdResult templateinfo = PdOptDb.getInstance().modifyDb(db, "templateinfo", values, "id = ?", new String[]{data.get(0).getId().toString()});
                System.out.println("sdkljfl");
            }


//            new Thread(() -> {
//
//                searchAll();
//
//            }).start();
//            new Thread(() -> {
//
//                modify();
//
//            }).start();

//            new Thread(() -> {
//
//                PdResult pdResult = PdOptDb.getInstance().removeDb("templateinfo", "id = ?", new String[]{"1194"}, db);
//
////                ContentValues values = new ContentValues();
////                values.put("id",  99);
////                values.put("name", "新增的");
////                PdResult pdResult1 = PdOptDb.getInstance().addDb("templateinfo", values, db);
//
//            }).start();
//            new Thread(() -> {
//
//                queryGpkg();
//
//            }).start();
//            new Thread(() -> {
//
//                modifyGpkg();
//
//            }).start();


        });
        findViewById(R.id.remove).setOnClickListener(v -> {
            PdOptGpkg.getInstance().rebackData(mPolygonShpLayer);
//            new Thread(() -> {
//                PdResult<List<TemplateInfo>> listPdResult = PdOptDb.getInstance().searDbByWhere(db, "templateinfo", "limit 1", null, TemplateInfo.class);
//                System.out.println("sdkjhfkj");
//
////                searchAll();
//            }).start();

        });

        findViewById(R.id.sfzy).setOnClickListener(v -> {
//            searchAll();
            PdOptDb.getInstance().rebackData(db);
            System.out.println("sdjkf");
        });


    }


    @RequiresApi(api = Build.VERSION_CODES.O)
    private void modifyGpkg() {
        String[] string = getString();
        for (String str : string) {
            QueryParameters query = new QueryParameters();
            query.setWhereClause("1=1");
            String whereClause = query.getWhereClause();
            PdResult<List<Feature>> listPdResult = PdOptGpkg.getInstance().searchInfo(mPolygonShpLayer, query);
            if (listPdResult.getStatus()) {


//                PdOptGpkg.getInstance().rebackData(mPolygonShpLayer);


                Log.e("Gpkg查询成功", " data2.getName()");
                Feature feature = listPdResult.getData().get(0);
                feature.getAttributes().put("collectTime", "dengpp");
//                PdResult pdResult = PdOptGpkg.getInstance().modifyGpkgInfo(mPolygonShpLayer, feature, whereClause);
                PdResult pdResult = PdOptGpkg.getInstance().removeGpkgInfo(mPolygonShpLayer, feature, whereClause);
                if (pdResult.getStatus()) {
                    Log.e("Gpkg修改成功", " data2.getName()");
                }
            }
        }
    }

    /**
     *
     */

    private void queryGpkg() {
        String[] string = getString();
        for (String str : string) {
            QueryParameters query = new QueryParameters();
            query.setWhereClause("specklesCode = '" + str + "'");
            PdResult<List<Feature>> listPdResult = PdOptGpkg.getInstance().searchInfo(mPolygonShpLayer, query);
            if (listPdResult.getStatus()) {
                List<Feature> data = listPdResult.getData();
                Feature feature = data.get(0);
                Map<String, Object> attributes = feature.getAttributes();
                String string1 = feature.getAttributes().get("specklesName").toString();
                Log.e("Gpkg查询成功", " specklesName---------------------------" + string1);
            } else {
                Log.e("Gpkg查询失败", " data2.getName()");
            }
        }

    }


    private void modify() {
        try {
            for (int i = 0; i < sum; i++) {
                String dbName = "templateinfo";
                if (i == 2) {
                    dbName = "app_gpkg_control";
                }
                if (i == 4) {
                    dbName = "app_phase_config";
                }
                ContentValues values = new ContentValues();
                values.put("name", "111");
                if (i == 2) {
                    values.put("name", "222");
                }
                if (i == 4) {
                    values.put("name", "444");
                }

                String where = "id = ?";
                int finalI = i;
                PdResult pdResult = PdOptDb.getInstance().modifyDb(db, dbName, values, where, new String[]{"1"});
                Boolean status = pdResult.getStatus();
                if (status) {
                    Log.e("查询修改成功", " -----------------------完" + finalI + "成-------------");
                } else {
                    Log.e("查询修改失败", " -----------------------完" + finalI + "成-------------");
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    private void searchAll() {
        for (int i = 0; i < sum; i++) {
            String dbName = "templateinfo";
            if (i == 2) {
                dbName = "app_gpkg_control";
            }
            if (i == 4) {
                dbName = "app_phase_config";
            }
            PdResult<List<TemplateInfo>> listPdResult = PdOptDb.getInstance().searchDb(db, TemplateInfo.class);

            if (listPdResult.getStatus()) {
                List<TemplateInfo> data = listPdResult.getData();
                Boolean status1 = listPdResult.getStatus();

                for (TemplateInfo templateInfo : data) {
                    String string = templateInfo.toString();
                    Log.e("查询全部:" + i, templateInfo.getName());
                    PdResult pdResult = PdOptDb.getInstance().removeDb(db, dbName, "id = ?", new String[]{templateInfo.getId().toString()});
                    if (pdResult.getStatus()) {
                        Log.e("查询单个:" + i, "-----------------------删除成功");
                    } else {
                        Log.e("查询单个:" + i, "-----------------------删除失败");
                    }

                    List<ContentValues> list = new ArrayList<>();

                    ContentValues values = new ContentValues();
                    values.put("id", i + 999);
                    values.put("name", "批量新增的");

                    list.add(values);

                    ContentValues values1 = new ContentValues();
                    values1.put("id", i + 9999);
                    values1.put("name", "批量新增的");
                    list.add(values1);

                    PdResult pdResult1 = PdOptDb.getInstance().addDb(db, dbName, list);
                    if (pdResult1.getStatus()) {
                        Log.e("查询单个:" + i, "-----------------------新增的成功");
                    } else {
                        Log.e("查询单个:" + i, "-----------------------新增的失败");
                    }
                }
            }

        }
    }

    private void searchOne() {
        for (int i = 0; i < sum; i++) {
            String dbName = "templateinfo";
            if (i == 2) {
                dbName = "app_gpkg_control";
            }
            if (i == 4) {
                dbName = "app_phase_config";
            }
            PdResult<TemplateInfo> templateinfo1 = PdOptDb.getInstance().searDbOneByWhere(db, dbName, "id = ?", new String[]{"1"}, TemplateInfo.class);
            Boolean status = templateinfo1.getStatus();
            if (status) {
                TemplateInfo data = templateinfo1.getData();
                Log.e("查询单个:" + i, data.getName());
                PdResult pdResult = PdOptDb.getInstance().removeDb(db, dbName, "id = ?", new String[]{data.getId().toString()});
                if (pdResult.getStatus()) {
                    Log.e("查询单个:" + i, "-----------------------删除成功");
                } else {
                    Log.e("查询单个:" + i, "-----------------------删除失败");
                }
                ContentValues values = new ContentValues();
                values.put("id", i + 99);
                values.put("name", "新增的");
                PdResult pdResult1 = PdOptDb.getInstance().addDb(db, dbName, values);
                if (pdResult1.getStatus()) {
                    Log.e("查询单个:" + i, "-----------------------新增的成功");
                } else {
                    Log.e("查询单个:" + i, "-----------------------新增的失败");
                }
            }

        }
    }

    /**
     * 2025年3月10日18:47:59
     * 测试传入，获取传入对象的字段和字段类型，获取字段类型后获取数据返回
     *
     * @param sqLiteOpenHelper
     * @param dbName
     * @param data
     * @param <T>
     */
    public <T> void searchDb(SQLiteDatabase sqLiteOpenHelper, String dbName, Class<T> data) {
//        Field[] fields = data.getDeclaredFields();
//        String fieldArrStr = "";
//        for (Field field : fields) {
//            System.out.println("Field name: " + field.getName());
//            // 获取字段类型
//            Class<?> fieldType = field.getType();
//            System.out.println("Field type: " + fieldType.getName());
//            Field mnodifyField = null;
//
//
//            try {
//                // 获取字段 value
//                mnodifyField = data.getDeclaredField("value");
//                mnodifyField.setAccessible(true); // 设置可以访问私有字段
//
//                // 修改字段值
//                mnodifyField.set(data, "newValue");
//
//                // 返回修改后的对象
////                return data;
//            } catch (Exception e) {
//                e.printStackTrace();
//            }
//
//            // 如果字段类型是泛型，输出具体的泛型类型
//            Type genericType = field.getGenericType();
//            if (genericType instanceof ParameterizedType) {
//                ParameterizedType pt = (ParameterizedType) genericType;
//                Type[] typeArgs = pt.getActualTypeArguments();
//                for (Type typeArg : typeArgs) {
//                    System.out.println("Generic type: " + typeArg.getTypeName());
//                }
//            }
//            /**
//             * 判断字段类型
//             */
//            if (fieldType == String.class) {
//                System.out.println("dsfjl");
//            }
//        }
//
//        if (fieldArrStr.length() > 0) {
//            String substring = fieldArrStr.substring(fieldArrStr.length() - 1, fieldArrStr.length());
//        } else {
//            System.out.println("sdjkfhk");
//        }

    }


    /**
     * 读取GPKG数据库
     */
    public String dbPath;
    public String dbName = "collect_back_1.gpkg";

    private void loadGpkg() {
        dbPath = Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator + "collect";
        mArcGISMap.getOperationalLayers().clear();
        GeoPackage geoPackage1 = new GeoPackage(dbPath + File.separator + dbName);
        geoPackage1.loadAsync();
        geoPackage1.addDoneLoadingListener(() -> {
            if (geoPackage1.getLoadStatus() == LoadStatus.LOADED) {
                List<GeoPackageFeatureTable> geoPackageFeatureTables = geoPackage1.getGeoPackageFeatureTables();
                if (geoPackageFeatureTables != null) {
                    try {
                        for (GeoPackageFeatureTable geoPackage : geoPackageFeatureTables) {
                            StringBuilder gpkgCond = new StringBuilder();
                            mFeatureLayer = new FeatureLayer(geoPackage);
                            gpkgCond.append("userId=").append("'").append(Constants.userId).append("'")
                                    .append(" and pac = ").append("'").append(Constants.pac).append("'");
                            switch (geoPackage.getTableName()) {
                                case "point": {//点状采样样式
                                    mFeatureLayer.setRenderer(gpkgColorConfig(gpkgCond.toString(), "point"));
                                    mPointShpLayer = mFeatureLayer;
                                    mPointShpLayer.setVisible(true);
                                    break;
                                }
                                case "polyline": {//线状采样样式
                                    mFeatureLayer.setRenderer(gpkgColorConfig(gpkgCond.toString(), "polyline"));
                                    mPolylineShpLayer = mFeatureLayer;
                                    mPolylineShpLayer.setVisible(true);
                                    break;
                                }
                                case "polygon": {//面状采样样式
                                    UniqueValueRenderer polygon = gpkgColorConfig(gpkgCond.toString(), "polygon");
                                    polygon.getDefaultSymbol();
                                    mFeatureLayer.setRenderer(polygon);
                                    mPolygonShpLayer = mFeatureLayer;
                                    mPolygonShpLayer.setVisible(true);
                                    break;
                                }
                            }
                            Log.e("readGpkg", geoPackage.getTableName());
                            mArcGISMap.getOperationalLayers().add(mFeatureLayer);
                            mapview.setViewpointRotationAsync(0);
                        }
                    } catch (Exception exception) {
                        Log.e("readGpkg", "读取gpkg异常:" + exception.getMessage());
                        exception.printStackTrace();
                    } finally {
                        Log.e("readGpkg", "读取gpkgfinally:");
                    }
                }
            }
        });
    }

    /**
     * 读取Gpkg配置颜色
     *
     * @param gpkgCond
     * @param type
     * @return
     */
    public static UniqueValueRenderer gpkgColorConfig(String gpkgCond, String type) {
        if (gpkgCond != null) {
            mFeatureLayer.setDefinitionExpression(gpkgCond);
        }
        //查询出gpkg控制所有的信息 //参数：point,polyline,polygon
        String[] colors = null;
        int total = 3;
        String field = "isupload";
        colors = new String[]{"#F80404", "#F4DC0A", "#1CF804"};


        //设置分级设色图样式，使用唯一值渲染
        UniqueValueRenderer uniqueValueRenderer = new UniqueValueRenderer();
        //添加shp中需要进行分级设色的属性字段
        uniqueValueRenderer.getFieldNames().add(field);

        //设置10个等级，即对应10种颜色
        List<SimpleMarkerSymbol> simpleMarkerSymbols = new ArrayList<>();//点
        List<SimpleLineSymbol> simpleLineSymbols = new ArrayList<>();//线
        List<SimpleFillSymbol> simpleFillSymbols = new ArrayList<>();// 面

        if ("polygon".equalsIgnoreCase(type)) {
            for (String color : colors) {
                String replace = color.replace("#", "");
                SimpleFillSymbol simpleFillSymbol = new SimpleFillSymbol(SimpleFillSymbol.Style.SOLID, Color.parseColor("#33" + replace),
                        new SimpleLineSymbol(SimpleLineSymbol.Style.DASH, Color.parseColor("#" + replace), 2.0f));
                simpleFillSymbols.add(simpleFillSymbol);
            }
            //遍历属性字段值添加对应颜色
            for (int d = 0; d < total; d++) {
                List<Object> value = new ArrayList<>();
                value.add(d);

                uniqueValueRenderer.getUniqueValues().add(
                        new UniqueValueRenderer.UniqueValue("value", "State of value", simpleFillSymbols.get(d),
                                value));
            }
            uniqueValueRenderer.getDefaultSymbol();
        } else if ("polyline".equalsIgnoreCase(type)) {
            for (String color : colors) {
                SimpleLineSymbol simpleFillSymbol = new SimpleLineSymbol(SimpleLineSymbol.Style.SOLID, Color.parseColor(color),
                        2.0f);
                simpleLineSymbols.add(simpleFillSymbol);
            }
            //遍历属性字段值添加对应颜色
            for (int d = 0; d < total; d++) {
                List<Object> value = new ArrayList<>();
                value.add(d);

                uniqueValueRenderer.getUniqueValues().add(
                        new UniqueValueRenderer.UniqueValue("value", "State of value", simpleLineSymbols.get(d),
                                value));
            }
        } else {
            for (String color : colors) {
                SimpleMarkerSymbol simpleFillSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.Style.CIRCLE, Color.parseColor(color),
                        10);
                simpleMarkerSymbols.add(simpleFillSymbol);
            }
            //遍历属性字段值添加对应颜色
            for (int d = 0; d < total; d++) {
                List<Object> value = new ArrayList<>();
                value.add(d);

                uniqueValueRenderer.getUniqueValues().add(
                        new UniqueValueRenderer.UniqueValue("value", "State of value", simpleMarkerSymbols.get(d),
                                value));
            }
        }

        return uniqueValueRenderer;
    }


    private String[] getString() {
        return new String[]{
                "2024_299946",
                "2024_299947",
                "2024_299948",
                "2024_299949",
                "2024_299950",
                "2024_299951",
                "2024_299952",
                "2024_299953",
                "2024_299954",
                "2024_299955",
                "2024_299956",
                "2024_299957",
                "2024_299958",
                "2024_299959",
                "2024_299960",
                "2024_299961",
                "2024_299962",
                "2024_299963",
                "2024_299964",
                "2024_299965",
                "2024_299966",
                "2024_299967",
                "2024_299968",
                "2024_299969",
                "2024_299970",
                "2024_299971",
                "2024_299972",
                "2024_299973",
                "2024_299974",
                "2024_299975",
                "2024_299976",
                "2024_299977",
                "2024_300000",
                "2024_300001",
                "2024_300002",
                "2024_300004",
                "2024_300005",
                "2024_300006",
                "2024_300007",
                "2024_300008",
                "2024_300009",
                "2024_300010",
                "2024_300011",
                "2024_300012",
                "2024_300013",
                "2024_300014",
                "2024_300015",
                "2024_300016",
                "2024_300017",
                "2024_300018",
                "2024_300019",
                "2024_300020",
                "2024_300021",
                "2024_300022",
                "2024_300023",
                "2024_300024",
                "2024_300025",
                "2024_300026",
                "2024_300027",
                "2024_300028",
                "2024_300029",
                "2024_300030",
                "2024_300031",
                "2024_300032",
                "2024_300033",
                "2024_300034",
                "2024_300035",
                "2024_300036",
                "2024_300037",
                "2024_300038",
                "2024_300039",
                "2024_300040",
                "2024_300041",
                "2024_300042",
                "2024_300043",
                "2024_300044",
                "2024_300045",
                "2024_300046",
                "2024_300047",
                "2024_300048",
                "2024_300049",
                "2024_300050",
                "2024_300051",
                "2024_300052",
                "2024_300053",
                "2024_300054",
                "2024_300055",
                "2024_300056",
                "2024_300057",
                "2024_300058",
                "2024_300059",
                "2024_300060",
                "2024_300061",
                "2024_300062",
                "2024_300063",
                "2024_300064",
                "2024_300065",
                "2024_300066",
                "2024_300067",
                "2024_300068",
                "2024_300069",
                "2024_300070",
                "2024_300071",
                "2024_300072",
                "2024_300074",
                "2024_300075",
                "2024_300076",
                "2024_300077",
                "2024_300079",
                "2024_300083",
                "2024_300084",
                "2024_300086",
                "2024_300087",
                "2024_300089",
                "2024_300096",
                "2024_300097",
                "2024_300098",
                "2024_300108",
                "2024_300110",
                "2024_300139",
                "2024_300149",
                "2024_300164",
                "2024_300176",
                "2024_300178",
                "2024_300186",
                "2024_300199",
                "2024_300201",
                "2024_300206",
                "2024_300268",
                "2024_300269",
                "2024_300270",
                "2024_300273",
                "2024_300275",
                "2024_300276",
                "2024_300277",
                "2024_300280",
                "2024_300281",
                "2024_300282",
                "2024_300283",
                "2024_300284",
                "2024_300285",
                "2024_300287",
                "2024_300289",
                "2024_300290",
                "2024_300291",
                "2024_300294",
                "2024_300295",
                "2024_300296",
                "2024_300297",
                "2024_300298",
                "2024_300299",
                "2024_300303",
                "2024_300305",
                "2024_300308",
                "2024_300309",
                "2024_300310",
                "2024_300311",
                "2024_300312",
                "2024_300314",
                "2024_300316",
                "2024_300320",
                "2024_300321",
                "2024_300326",
                "2024_300327",
                "2024_300329",
                "2024_300330",
                "2024_300337",
                "2024_300339",
                "2024_300342",
                "2024_300344",
                "2024_300348",
                "2024_300351",
                "2024_300354",
                "2024_300355",
                "2024_300359",
                "2024_300362",
                "2024_300363",
                "2024_300365",
                "2024_300366",
                "2024_300367",
                "2024_300375",
                "2024_300376",
                "2024_300378",
                "2024_300379",
                "2024_300383",
                "2024_300385",
                "2024_300386",
                "2024_300387",
                "2024_300390",
                "2024_300393",
                "2024_300395",
                "2024_300400",
                "2024_300403",
                "2024_300405",
                "2024_300409",
                "2024_300410",
                "2024_300412",
                "2024_300417",
                "2024_300418",
                "2024_300419",
                "2024_300424",
                "2024_300426",
                "2024_300427",
                "2024_300429",
                "2024_300431",
                "2024_300436",
                "2024_300439",
                "2024_300440",
                "2024_300442",
                "2024_300446",
                "2024_300448",
                "2024_300450",
                "2024_300451",
                "2024_300453",
                "2024_300456",
                "2024_300461",
                "2024_300466",
                "2024_300474",
                "2024_300480",
                "2024_300490",
                "2024_300491",
                "2024_300492",
                "2024_300494",
                "2024_300495",
                "2024_300496",
                "2024_300497",
                "2024_300498",
                "2024_300499",
                "2024_300500",
                "2024_300501",
                "2024_300502",
                "2024_300503",
                "2024_300504",
                "2024_300505",
                "2024_300506",
                "2024_300507",
                "2024_300508",
                "2024_300509",
                "2024_300510",
                "2024_300511",
                "2024_300512",
                "2024_300513",
                "2024_300514",
                "2024_300515",
                "2024_300516",
                "2024_300517",
                "2024_300518",
                "2024_300519",
                "2024_300520",
                "2024_300521",
                "2024_300522",
                "2024_300523",
                "2024_300524",
                "2024_300525",
                "2024_300527",
                "2024_300528",
                "2024_300529",
                "2024_300530",
                "2024_300531",
                "2024_300532",
                "2024_300533",
                "2024_300534",
                "2024_300535",
                "2024_300536",
                "2024_300537",
                "2024_300538",
                "2024_300539",
                "2024_300540",
                "2024_300541",
                "2024_300542",
                "2024_300543",
                "2024_300544",
                "2024_300545",
                "2024_300546",
                "2024_300549",
                "2024_300550",
                "2024_300551",
                "2024_300552",
                "2024_300553",
                "2024_300554",
                "2024_300556",
                "2024_300557",
                "2024_300558",
                "2024_300562",
                "2024_300565",
                "2024_300566",
                "2024_300570",
                "2024_300572",
                "2024_300573",
                "2024_300574",
                "2024_300575",
                "2024_300576",
                "2024_300577",
                "2024_300578",
                "2024_300580",
                "2024_300583",
                "2024_300584",
                "2024_300585",
                "2024_300586",
                "2024_300587",
                "2024_300588",
                "2024_300589",
                "2024_300590",
                "2024_300592",
                "2024_300593",
                "2024_300594",
                "2024_300595",
                "2024_300596",
                "2024_300597",
                "2023_255057",
                "2023_255134",
                "2023_262301",
                "2023_262302",
                "2023_262304",
                "2023_262305",
                "2023_268252",
                "2023_268257",
                "2023_280265",
                "2023_280266",
                "2023_287578",
                "2023_287583",
                "2023_287584",
                "2023_287590",
                "2023_287605",
                "2023_292815",
                "2023_292821",
                "2023_311694",
                "2023_311695",
                "2023_311696",
                "2023_311697",
                "2023_311698",
                "2023_311700",
                "2023_311701",
                "2023_311702",
                "2023_311703",
                "2023_311704",
                "2023_311705",
                "2023_311706",
                "2023_311707",
                "2023_311708",
                "2023_311709",
                "2023_311711",
                "2023_311712",
                "2023_311713",
                "2023_311733",
                "2023_311741",
                "2023_314930",
                "2023_314931",
                "2023_314937",
                "2023_314938",
                "2023_314941",
                "2023_314942",
                "2023_314945",
                "2023_314946",
                "2023_314947",
                "2023_315182",
                "2023_315184",
                "2022_228471",
                "2022_237032",
                "2022_260421",
                "2022_260422",
                "2022_260423",
                "2022_260424",
                "2022_260425",
                "2022_260427",
                "2022_260428",
                "2022_260429",
                "2022_260430",
                "2022_260431",
                "2022_260432",
                "2022_260433",
                "2022_260434",
                "2022_260435",
                "2022_260436",
                "2022_260437",
                "2022_260438",
                "2022_260440",
                "2022_260441",
                "2022_260442",
                "2022_260443",
                "2022_260743",
                "2022_260744",
                "2022_260745",
                "2022_260746",
                "2022_260747",
                "2022_261281",
                "2022_261282",
                "2022_261283",
                "2022_261284",
                "2022_261285",
                "2022_261286",
                "2022_261287",
                "2022_261288",
                "2022_261289",
                "2022_261290",
                "2022_261291",
                "2022_261292",
                "2022_261293",
                "2022_261294",
                "2022_261295",
                "2022_261296",
                "2022_261297",
                "2022_261298",
                "2022_261308",
                "2022_261309",
                "2022_261312",
                "2022_261313",
                "2022_261355",
                "2022_261356",
                "2022_261357",
                "2022_261358",
                "2022_261359",
                "2022_261360",
                "2022_261396",
                "2022_261397",
                "2022_262333",
                "2022_262334",
                "2022_262335",
                "2022_262336",
                "2022_262337",
                "2022_262338",
                "2022_262339",
                "2022_262340",
                "2022_262341",
                "2022_262342",
                "2022_262343",
                "2022_275748",
                "2022_275839",
                "2022_275840",
                "2022_275841",
                "2020_213400",
                "2020_213401",
                "2020_213402",
                "2020_215958",
                "2020_215959",
                "2020_215960",
                "2020_215961",
                "2020_215962",
                "2020_215963",
                "2020_215964",
                "2020_222801",
                "2020_222802",
                "2020_222803",
                "2020_222804",
                "2020_222805",
                "2020_222806",
                "2020_222807",
                "2020_222808",
                "2020_222809",
                "2020_222810",
                "2020_222811",
                "2020_222812",
                "2020_222813",
                "2020_236422",
                "2020_236423",
                "2020_236424",
                "2020_236425",
                "2020_236426",
                "2020_236427",
                "2020_236428",
                "2020_236429",
                "2020_236430",
                "2020_245198",
                "2020_245199",
                "2020_245200",
                "2020_245201",
                "2020_245202",
                "2020_245203",
                "2020_245204",
                "2020_245205",
                "2020_245206",
                "2020_248104",
                "2020_248105",
                "2020_248106",
                "2020_248107",
                "2020_248108",
                "2020_248109",
                "2020_248110",
                "2020_248111",
                "2020_248112",
                "2020_248616",
                "2020_248617",
                "2020_248618",
                "2020_248619",
                "2020_248620",
                "2020_248621",
                "2020_248622",
                "2020_248623",
                "2020_248624",
                "2020_248625",
                "2020_248626",
                "2020_248627",
                "2020_248808",
                "2020_248809",
                "2020_248810",
                "2020_248811",
                "2020_248812",
                "2020_248813",
                "2020_248814",
                "2020_248815",
                "2020_248816",
                "2020_248817",
                "2020_248818",
                "2020_269644",
                "2020_269645",
                "2020_269646",
                "2020_269647",
                "2020_269648",
                "2020_269649",
                "2020_272736",
                "2020_272737",
                "2020_272738",
                "2020_272739",
                "2020_272872",
                "2020_272873",
                "2020_272874",
                "2020_272875",
                "2020_272876",
                "2020_272877",
                "2020_272878",
                "2020_272879",
                "2020_272880",
                "2020_272881",
                "2020_274982",
                "2020_274983",
                "2020_274984",
                "2020_288860",
                "2020_288861",
                "2020_288862",
                "2020_288863",
                "2020_288864",
                "2020_288865",
                "2020_288866",
                "2020_288867",
                "2020_288868",
                "2020_288869",
                "2020_288870",
                "2020_288871",
                "2020_288872",
                "2020_289534",
                "2020_289535",
                "2020_289536",
                "2020_289537",
                "2020_289538",
                "2020_289539",
                "2020_289540",
                "2020_289541",
                "2020_289542",
                "2020_289543",
                "2020_289544",
                "2020_289545",
                "2020_289546",
                "2020_289547",
                "2020_289548",
                "2020_289549",
                "2020_289550",
                "2020_289551",
                "2020_289552",
                "2020_289553",
                "2020_289554",
                "2020_296554",
                "2020_296555",
                "2020_296556",
                "2020_304424",
                "2021_275356",
                "2021_275357",
                "2021_275358",
                "2021_275359",
                "2021_275360",
                "2021_275361",
                "2021_275362",
                "2021_275363",
                "2021_275364",
                "2021_275365",
                "2021_275366",
                "2021_275367",
                "2021_275368",
                "2021_275369",
                "2021_275370",
                "2021_275371",
                "2021_275372",
                "2021_275373",
                "2021_275374",
                "2021_275375",
                "2021_275376",
                "2021_275377",
                "2021_275378",
                "2021_275379",
                "2021_275380",
                "2021_275381",
                "2021_275382",
                "2021_275383",
                "2021_275384",
                "2021_275385",
                "2021_275386",
                "2021_275387",
                "2021_275388",
                "2021_275396",
                "2021_275397",
                "2021_275398",
                "2021_275399",
                "2021_275400",
                "2021_275401",
                "2021_275402",
                "2021_275403",
                "2021_275404",
                "2021_275405",
                "2021_275406",
                "2021_275407",
                "2021_275408",
                "2021_275409",
                "2021_275410",
                "2021_275411",
                "2021_275412",
                "2021_275413",
                "2021_275414",
                "2021_275415",
                "2021_275416",
                "2021_275417",
                "2021_275418",
                "2021_275419",
                "2021_275444",
                "2021_275445",
                "2021_275446",
                "2021_275447",
                "2021_275448",
                "2021_275449",
                "2021_275450",
                "2021_275451",
                "2021_275452",
                "2021_275453",
                "2021_275454",
                "2021_275455",
                "2021_275456",
                "2021_275457",
                "2021_275458",
                "2021_275557",
                "2021_275558",
                "2021_275563",
                "2021_275564",
                "2021_275565"
        };
    }
}